const Mock = require("mockjs")
const query = require("./mysql")


// //新房
// let { shop_list } = Mock.mock({
//     "shop_list|20": [{
//         img: "https://unsplash.it/400/800/?@name",
//         title: "@ctitle(10,15)",
//         roomeType: /一室|两室|三室\+/,
//         price: "@integer(10000,10000200)",
//         roomeArea: "@integer(100,500)",
//         code: "@zip",
//         "countrysx": "@county(true)",
//         state: /新房|二手房/,
//         direction: /东|西|南|北|/
//     }]
// })
// shop_list.forEach(item => {
//     let sql = `insert into newHouse (img,title,roomeType,price,roomeArea,provinces,cities,areas,code,countrysx,state,direction ) values ("${item.img}","${item.title}","${item.roomeType}","${item.price}","${item.roomeArea}","${item.countrysx.split(' ')[0]}","${item.countrysx.split(' ')[1]}","${item.countrysx.split(' ')[2]}","${item.code}","${item.countrysx}","${item.state}","${item.direction}") `
//     query(sql)
// })

//消息
// let { shop_list } = Mock.mock({
//     "shop_list|10": [{
//         img: "https://unsplash.it/400/800/",
//         name: "@cname",
//         time: "@date",
//         context: '@cword(10,20)'
//     }]
// })
// shop_list.forEach(item => {
//     let sql = `insert into message (img,name,context,time ) values ("${item.img}","${item.name}","${item.context}","${item.time}") `
//     query(sql)
// })

// 公告
// let { shop_list } = Mock.mock({
//     "shop_list|10": [{
//         title: "@cword(10,20)",
//         time: "@date",
//         context: '@cword(10,20)'
//         // img: "https://unsplash.it/400/800/?@name"
//     }]
// })
// shop_list.forEach(item => {
//     let sql = `insert into announcement ( title,context,time ) values ( "${item.title}","${item.context}","${item.time}") `
//     query(sql)
// })


//求租、求购
// let { shop_list } = Mock.mock({
//     "shop_list|50": [{
//         name: "@cname",
//         title: "@ctitle(10,15)",
//         area: /昌平区|海淀区|奉贤区|丰台区|浦东区|静安区|闵行区|/,
//         price: '@integer(1000,20000)',
//         userImg: "https://unsplash.it/400/800/?@name",
//         roomType: /多层住宅|高层住宅|小高层住宅|商铺\/门面房|厂房|写字楼|独院\/别墅|车库/,
//         time: "@date"
//     }]
// })
// shop_list.forEach(item => {
//     let sql = `insert into rentHouse (userImg, name,title,area,price,roomType,time ) values ("${item.userImg}","${item.name}" ,"${item.title}","${item.area}","${item.price}","${item.roomType}","${item.time}") `
//     query(sql)
// })

//楼市圈
// let { shop_list } = Mock.mock({
//     "shop_list|50": [{
//         name: "@cname",
//         title: "@ctitle(10,15)",
//         date: "@date",
//         userImg: "https://unsplash.it/400/800/?@name",
//         img: "https://unsplash.it/400/800/?@name",
//     }]
// })
// shop_list.forEach(item => {
//     let sql = `insert into housingMarket (userImg, name,title,date,img ) values ("${item.userImg}","${item.name}" ,"${item.title}","${item.date}","${item.img}") `
//     query(sql)
// })

//团购
// let { shop_list } = Mock.mock({
//     "shop_list|50": [{
//         name: "@cname",
//         title: "@ctitle(10,15)",
//         time: "@date",
//         address: "@city(true)",
//         img: "https://unsplash.it/400/800/?@name",
//         peopleNum: '@integer(1,100)',
//         state: /开启|关闭/,
//         teamcontext: "@cword(25,45)",
//         userImg: "https://unsplash.it/400/800/?@name",
//         phone: /^1(?:3\d|4[4-9]|5[0-35-9]|6[67]|7[013-8]|8\d|9\d)\d{8}$/
//     }]
// })
// shop_list.forEach(item => {
//     let sql = `insert into teamBuy (name,img, title,address,time,peopleNum,state,teamcontext,userImg,phone) values ("${item.name}","${item.img}","${item.title}","${item.address}" ,"${item.time}","${item.peopleNum}","${item.state}","${item.teamcontext}","${item.userImg}","${item.phone}") `
//     query(sql)
// })


//排行榜
// let { shop_list } = Mock.mock({
//     "shop_list|50": [{
//         userImg: "https://unsplash.it/400/800/?@name",
//         name: "@cname",
//         text: "@cword(4)",
//         detailImg: "https://unsplash.it/400/800/",
//         detailTitle: "@ctitle(10,15)",
//         detailRoomType: "@ctitle(5,9)",
//         roomSize: "@integer(50,200)",
//         price: "@integer(10,1000)",
//         sigPrice: "@integer(1000,10000)",
//         community: "@county",
//         date: "@date",
//         state: /卖房|租房/

//     }]
// })
// shop_list.forEach(item => {
//     let sql = `insert into ranking (userImg, name,text,detailImg,detailTitle,detailRoomType,roomSize,price,sigPrice, community,date,state) values ("${item.userImg}","${item.name}" ,"${item.text}","${item.detailImg}","${item.detailTitle}","${item.detailRoomType}","${item.roomSize}","${item.price}","${item.sigPrice}","${item.community}","${item.date}","${item.state}") `
//     query(sql)
// })


//战绩
// // //卖房
// let { shop_list } = Mock.mock({
//     "shop_list|50": [{
//         img: "https://unsplash.it/400/800/?@name",
//         title: "@ctitle(10,20)",
//         roomeType: "2室一厅",
//         roomSize: "@integer(50,200)",
//         address: "@county(true)",
//         price: "@integer(100,500)",
//         sigPrice: "@integer(10000,100000)",
//         type: "小区"

//     }]
// })
// shop_list.forEach(item => {
//     let sql = `insert into buyRoom (img, title,roomeType,roomSize,address,price,sigPrice,type,provinces,cities,areas) values ("${item.img}","${item.title}" ,"${item.roomeType}","${item.roomSize}平方米" ,"${item.address}","${item.price}万","${item.sigPrice}/平","${item.type}","${item.address.split(' ')[0]}","${item.address.split(' ')[1]}","${item.address.split(' ')[2]}" ) `
//     query(sql)
// })